﻿using System;
using System.ComponentModel;

namespace RobotGerchik.DataClass.BaseTransaqCalss
{
    public class Candle : INotifyPropertyChanged
    {
        #region Private

        private DateTime _dateTime;
        private double _open;
        private double _high;
        private double _low;
        private double _close;
        private int _volume;
        private int _oi;

        #endregion

        #region Public
        /// <summary>
        /// Дата и время
        /// </summary>
        public DateTime DateTime
        {
            get { return _dateTime; }
            set
            {
                if (_dateTime != value)
                {
                    _dateTime = value;
                    RaisePropertyChanged("DateTime");
                }
            }
        }

        /// <summary>
        /// Открытие
        /// </summary>
        public double Open
        {
            get { return _open; }
            set
            {
                if (_open != value)
                {
                    _open = value;
                    RaisePropertyChanged("Open");
                }
            }
        }

        /// <summary>
        /// Хай
        /// </summary>
        public double High
        {
            get { return _high; }
            set
            {
                if (_high != value)
                {
                    _high = value;
                    RaisePropertyChanged("High");
                }
            }
        }

        /// <summary>
        /// ЛОу
        /// </summary>
        public double Low
        {
            get { return _low; }
            set
            {
                if (_low != value)
                {
                    _low = value;
                    RaisePropertyChanged("Low");
                }
            }
        }

        /// <summary>
        /// Закрытие
        /// </summary>
        public double Close
        {
            get { return _close; }
            set
            {
                if (_close != value)
                {
                    _close = value;
                    RaisePropertyChanged("Close");
                }
            }
        }

        /// <summary>
        /// объем
        /// </summary>
        public int Volume
        {
            get { return _volume; }
            set
            {
                if (_volume != value)
                {
                    _volume = value;
                    RaisePropertyChanged("Volume");
                }
            }
        }

        /// <summary>
        /// открытый интерес
        /// </summary>
        public int Oi
        {
            get { return _oi; }
            set
            {
                if (_oi != value)
                {
                    _oi = value;
                    RaisePropertyChanged("Oi");
                }
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
